]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowPreview: Ensure style as soon as preview is realized
authorJonas Dreßler <verdre@v0yd.nl>
Mon, 6 Jul 2020 13:44:25 +0000 (15:44 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 6 Jul 2020 21:16:15 +0000 (23:16 +0200)
For the windowPreview we need to ensure the style information of the
border and title is up-to-date when chromeWidths() or chromeHeights() is
called. Since the introduction of the WorkspaceLayout those functions
may be called during an allocation cycle, which means we should avoid
calling queuing relayouts inside them. Calling StWidgets ensure_style()
method will queue a relayout though in case the newly generated theme
node has a different geometry.

So avoid queueing a relayout during allocation cycles (and the warning
Clutter logs because of that) by ensuring the style of the border and
title earlier, as soon as the WindowPreview is attached to a stage.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1305

js/ui/windowPreview.js

index 69e3ee57487b581a9b4a3f5df51118412f7588d3..caa0732648d2098eb2789874ab88539ca08682e7 100644 (file)
@@ -347,6 +347,14 @@ var WindowPreview = GObject.registerClass({
         this.add_child(this._border);
         this.add_child(this._title);
         this.add_child(this._closeButton);
+
+        this.connect('notify::realized', () => {
+            if (!this.realized)
+                return;
+
+            this._border.ensure_style();
+            this._title.ensure_style();
+        });
     }
 
     vfunc_get_preferred_width(forHeight) {
@@ -401,8 +409,6 @@ var WindowPreview = GObject.registerClass({
     }
 
     chromeHeights() {
-        this._border.ensure_style();
-        this._title.ensure_style();
         const [, closeButtonHeight] = this._closeButton.get_preferred_height(-1);
         const [, titleHeight] = this._title.get_preferred_height(-1);
 
@@ -415,7 +421,6 @@ var WindowPreview = GObject.registerClass({
     }
 
     chromeWidths() {
-        this._border.ensure_style();
         const [, closeButtonWidth] = this._closeButton.get_preferred_width(-1);
 
         const leftOversize = this._closeButtonSide === St.Side.LEFT